package com.irdstudio.apicenter.core.dvo;

/**
 * 响应值对象（由响应码+响应信息组成)
 * 
 * @author zs.ligm
 * @version 1.0
 * @date 2015-08-07
 */
public class RspValue {

	/* 错误码,0表示成功 */
	public String ec = "0";

	/* 错误信息 */
	public String em = "";

	/**
	 * 构造函数,用于自定义错误码与错误信息
	 * 
	 * @param ec
	 * @param em
	 */
	public RspValue(String ec, String em) {
		this.ec = ec;
		this.em = em;
	}

	/**
	 * 构造函数,用于构造成功响应信息
	 */
	public RspValue() {
		this.ec = "0";
		this.em = "OK";
	}

	/**
	 * 构造函数,根据错误信息构造响应信息
	 * 
	 * @param em
	 */
	public RspValue(String em) {
		this.ec = "9";
		this.em = em;
	}

	public boolean isOK() {
		return "0".equals(ec);
	}

	public void resetToError() {
		this.setEc("9");
	}

	public String getEc() {
		return ec;
	}

	public void setEc(String ec) {
		this.ec = ec;
	}

	public String getEm() {
		return em;
	}

	public void setEm(String em) {
		this.em = em;
	}
}
